#ifndef CAMERAWORK_H
#define CAMERAWORK_H

#include <QObject>
#include <opencv2/opencv.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <QPaintEvent>
#include <QTimer>
#include <QPainter>
#include <QPixmap>
#include <QLabel>
#include <QImage>
#include <QTimer>
#include "facedetector.h"
#include <QString>

class Camerawork : public QObject
{
    Q_OBJECT
public:
    explicit Camerawork(QObject *parent = 0);
    void openCamera();
    void closeCamera();
    int runFacencnn(cv::Mat &image,QImage &img,cv::Mat &faceimage);
    int runFacencnn2(cv::Mat &image,QImage &img,cv::Mat &faceimage);

private:
    cv::VideoCapture capture;
    cv::VideoWriter writer;
    cv::Mat src_image;
    bool stopFlag=false;
    int camera_num = 0;
    cv::Mat peopleface;
    FaceDetector* faceDetector;
    int showcount=0;
    int piccount=0;

signals:
    void sendFace(cv::Mat face);
    void sendPicture(QImage img);
    void sendString(QString str);

public slots:
    void mainwindowDisplay();
    void mainwindowDisplay2();
    void getFace();
};

#endif // CAMERAWORK_H
